package com.schooldate.model.action;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.schooldate.base.BaseAction;
import com.schooldate.model.entity.UserInfo;
import com.schooldate.util.SimpleJsonFilter;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

/**
 * Created by etund on 2015/3/17 0017.
 */
@Controller
@Scope("prototype")
@SuppressWarnings("all")
public class IndexAction extends BaseAction<UserInfo> {

    /**
     * 首页准备数据
     * @return
     * @throws Exception
     */
    public void index() throws Exception{
//        鲜花数最多的
        userInfos = this.userInfoService.getByOrderFlowers();
//        广告，活动图片
        ads = this.adservice.getTheRecent();
        object.put("code",1);
        object.put("userInfos",userInfos);
        object.put("ads",ads);
        SimpleJsonFilter filter = new SimpleJsonFilter("index");
        result = JSON.toJSONString(object,filter, SerializerFeature.DisableCircularReferenceDetect);
        renderJson(result);
    }


}
